package cn.edu.sdjzu.usercenter.exception;

import cn.edu.sdjzu.usercenter.common.ErrorCode;
import lombok.Data;

/**
 * @projectName: user-center
 * @package: cn.edu.sdjzu.usercenter.exception
 * @className: BussinessException
 * @author: Liu
 * @description: 自定义异常
 * @date: 2024/3/29 8:56
 * @version: 1.0
 */
@Data
public class BusinessException extends RuntimeException{

    private final  int code;

    private final String description;

    public BusinessException(String message, int code, String description) {
        super(message);
        this.code = code;
        this.description = description;
    }

    public BusinessException(ErrorCode errorCode) {
        super(errorCode.getMessage());
        this.code = errorCode.getCode();
        this.description = errorCode.getDescription();
    }
    public BusinessException(ErrorCode errorCode, String description) {
        super(errorCode.getMessage());
        this.code = errorCode.getCode();
        this.description = description;
    }
}
